package com.eb.bi.common.util;

import java.io.File;

import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;

public class XMLProcessor {
	private SAXReader saxReader = new SAXReader();
	private Document document;
	private Element root;
	private String m_errorDesc;
	
	public String getM_errorDesc() {
		return m_errorDesc;
	}

	public boolean DocumentCreator(String filePath){
		try {
			this.document = saxReader.read(new File(filePath));
			this.root = this.document.getRootElement();
			return true;
		} catch (DocumentException e) {
			m_errorDesc = "xml DocumentException";
			return false;
		}
	}
	
	public Document getDocument() {
		return document;
	}
	public Element getRoot() {
		return root;
	}
}
